package com.wy.timer.impl;

import java.util.concurrent.TimeUnit;

/**
 * @author 美女
 * @date 2022/05/02 23:58
 **/
public class Main {
    public static void main(String[] args) throws InterruptedException {
        MyTimerTask t1=new MyTimerTask() {
            @Override
            void run() {
                System.out.println("5s之后");
            }
        };
        MyTimerTask t2=new MyTimerTask() {
            @Override
            void run() {
                System.out.println("4s之后");
            }
        };
        MyTimerTask t3=new MyTimerTask() {
            @Override
            void run() {
                System.out.println("3s之后");
            }
        };
        MyTimerTask t4=new MyTimerTask() {
            @Override
            void run() {
                System.out.println("2s之后");
            }
        };
        MyTimerTask t5=new MyTimerTask() {
            @Override
            void run() {
                System.out.println("1s之后");
            }
        };
        MyTimerTask t6=new MyTimerTask() {
            @Override
            void run() {
                System.out.println("2.5s之后");
            }
        };
        MyTimer myTimer=new MyTimer();
        myTimer.schedule(t1,5000);
        TimeUnit.SECONDS.sleep(1);
        myTimer.schedule(t6,1500);
//        myTimer.schedule(t2,4000);
//        myTimer.schedule(t3,3000);
//        myTimer.schedule(t4,2000);
//        myTimer.schedule(t5,1000);


    }
}
